<%@ page import="cn.ixinjiu.libraryMangement.entity.UserInfo" %><%-- 普通管理员主菜单 --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>普通管理员主菜单</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<%
    // url
    StringBuffer requestURL = request.getRequestURL();
    String[] split = requestURL.toString().split("jsp");
    String baseURL = split[0]; // http://localhost:8081/

    // userName
    UserInfo userInfo = (UserInfo) request.getSession().getAttribute("userInfo");
    String userName = userInfo.getUserName();
    String avatar = userInfo.getAvatar();
%>
<body>
<div class="layui-layout layui-layout-admin">
    <%-- 顶部开始 --%>
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">普通管理员主菜单</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src=<%= baseURL %><%= avatar %>
                                 class="layui-nav-img">
                    <%= userName %>
                </a>
                <dl class="layui-nav-child">
                    <dd id="personalDetails"><a href="#">Your Profile</a></dd>
                    <dd><a href="<%=baseURL%>logout">Sign out</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item to-index" style="background-color: orangered"><a href="/">登录页面</a></li>
        </ul>
    </div>
    <%--顶部结束--%>
        <%--左侧菜单开始--%>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;">图书管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="borrowBook.jsp" target="content">借阅图书</a></dd>
                        <dd><a href="returnBook.jsp" target="content">归还图书</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">功能管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="../systemAdmin/anno/annoList.jsp" target="content">公告</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <%--左侧菜单结束--%>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe src="borrowBook.jsp" name="content" height="100%" width="100%" frameborder="0" ></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        底部固定区域
    </div>
</div>
<script src="/static/layui/layui.js"></script>
<script>
    // JS
    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element
            , layer = layui.layer
            , util = layui.util
            , $ = layui.$;

        $('#personalDetails').on('click', function () {
            // 页面编辑
            layer.open({
                type: 2,
                title: "个人信息",
                area: ['800px', '800px'],
                maxmin: true, // 开启最大化最小化按钮
                shadeClose: true,
                content: "../systemAdmin/personalDetails.jsp",
                end: function () {
                    $(".layui-laypage-btn").click();
                }
            });
        })

        // 头部事件
        util.event('lay-header-event', {
            // 左侧菜单事件
            menuLeft: function (othis) {
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
            , menuRight: function () {
                layer.open({
                    type: 1
                    , content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
                    , area: ['260px', '100%']
                    , offset: 'rt' //右上角
                    , anim: 5
                    , shadeClose: true
                });
            }
        });

    });
</script>
</body>
</html>